package leetcode.lcp.lcp20220924;

//Solution1Test
public class Solution1 {

	public int temperatureTrend(int[] temperatureA, int[] temperatureB) {
		int ans = 0, sum = 0;
		for (int i = 1; i < temperatureB.length; i++) {
			int t1 = temperatureA[i], t2 = temperatureB[i];
			int t11 = temperatureA[i - 1], t22 = temperatureB[i - 1];
			if ((t1 == t11 && t2 == t22) || (t1 < t11 && t2 < t22) || (t1 > t11 && t2 > t22)) {
				sum++;
				ans = Math.max(ans, sum);
			} else {
				sum = 0;
			}
		}
		return ans;
	}
}
